package com.zoro.barn.commons.webcommons.webconfig;

import com.zoro.barn.commons.webcommons.filters.MultipleReadableServletRequestFilterConfig;
import com.zoro.barn.commons.webcommons.interceptors.LogInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zhaoxingwu
 */
@Import(MultipleReadableServletRequestFilterConfig.class)
public class LogInterceptorConfig implements WebMvcConfigurer {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LogInterceptor());
        logger.info(" request log interceptor added");
    }
}
